﻿@model IEnumerable<KRM.Core.vGetAllHeldOrder>

@{
    ViewBag.Title = "View Back Orders";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/js/tabletocsv.js"></script>
<div class="container-fluid">
    <div class="row-fluid">

        <ul class="tabs tabs-inline tabs-top orderdetail-task-tabs task-tabs">
            <li class="active">
                <a href="#viewheldorders" data-toggle="tab">View Held Orders</a>
            </li>
            <li>
                <a href="#viewbackorderedparts" data-toggle="tab" id="tabviewbackorderedparts">View Back Orderred Parts</a>
            </li>
        </ul>
        <div class="tab-content padding tab-content-inline tab-content-bottom orderdetail-task-tabs-content">
            <div class="tab-pane active" id="viewheldorders">
                <div class="row-fluid">
                    <div class="span7"></div>
                    <div class="span2">Order To Search For:</div>
                    <div class="span2">
                        <input type="text" name="OrderRef" id="txtOrderRef" class="input-block-level" />
                    </div>
                    <div class="span1">
                        <button type="submit" class="btn btn-primary" onclick="selectedheldorder($('#txtOrderRef').val());">Search</button>
                    </div>
                </div>
                <div class="fieldset">
                    <div class="legend">
                        <span>Held Orders</span>
                        <div class="row-fluid">
                            <div class="span12">
                                <a class="btn" style="padding: 0; max-height: 30px; float: right" onclick="ExportCSVWithHead($('#tb-heldorder'),'HeldOrder.csv',$('#tb-heldorder-head:first'))">
                                    <img src="/img/icon-exel.png" style="max-height: 30px">
                                </a>
                                <table class="table table-bordered table-fix krmtable tbl-selected" data-height="250" id="tb-heldorder">
                                    <thead id="tb-heldorder-head">
                                        <tr>
                                            <th>Order Ref</th>
                                            <th>Product Option</th>
                                            <th>Date Placed</th>
                                            <th>Customer Name</th>
                                            <th>Telephone</th>
                                            <th>Email Address</th>
                                            <th>Address Line 2</th>
                                            <th>Town</th>
                                            <th>County</th>
                                            <th>Postcode</th>
                                            <th>Store Name</th>
                                            <th>RDM Date Placed</th>
                                            <th>RDM OrderId</th>
                                            <th>Company Name</th>
                                            <th>Carrier Name</th>
                                            <th>Delivery Date</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach (var item in Model)
                                        {
                                            <tr onclick="loadhelditems('@item.OrderRef'); loadwaitingitems('@item.OrderRef');" data-orderref="@item.OrderRef">
                                                <td>@item.OrderRef</td>
                                                <td>@item.Product_Option</td>
                                                <td>@item.DatePlaced</td>
                                                <td>@item.CustomerName</td>
                                                <td>@item.Telephone</td>
                                                <td>@item.EmailAddress</td>
                                                <td>@item.AddressLine2</td>
                                                <td>@item.Town</td>
                                                <td>@item.County</td>
                                                <td>@item.Postcode</td>
                                                <td>@item.StoreName</td>
                                                <td>@item.RDMDatePlaced</td>
                                                <td>@item.RDMOrderId</td>
                                                <td>@item.CompanyName</td>
                                                <td>@item.CarrierName</td>
                                                <td>@item.DeliveryDate</td>
                                            </tr>
                                        }
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="itemwaitingresult" style="margin-top: 30px"></div>
                <div id="itemheldresult" style="margin-top: 30px"></div>
            </div>
            <div class="tab-pane" id="viewbackorderedparts">
            </div>

        </div>
    </div>
</div>

